<?php
class contact{

	function selectContact()
	{
		global $con;
		$sql="select * from tbl_contact";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	
	function addContact($contact_name,$contact_email,$contact_subject,$contact_msg,$contact_add_date)
	{
		global $con;
		$sql="INSERT INTO tbl_contact SET contact_name='$contact_name', contact_email='$contact_email',
		contact_subject='$contact_subject',contact_message='$contact_msg',contact_added_date='$contact_add_date'";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	function deleteContact($id)
	{
		global $con;
		$sql="DELETE FROM tbl_contact WHERE contact_id='$id' ";
		mysqli_query($con,$sql);
	}
	function sendmail($to,$name,$sub,$msg,$senderEmail,$senderName)
	
		{
	
		/* To send HTML mail, you can set the Content-type header. */
	
		$headers  = "MIME-Version: 1.0\r\n";
	
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	
		/* additional headers */
	
		$headers .= "To: $to <$to>\r\n";	
	
		$headers .= "From: $senderName <$senderEmail>\r\n";
	
		/* and now mail it */
	
		mail($to, $sub, $msg, $headers);	
	
		}


	
	
}//EOC


$objContact=new contact();
?>
